# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import base64
import os
import requests
import urllib
import urllib2
import numpy as np
import json
import numpy as np
import cv2.cv as cv
import cv2
import random
from django.test import TestCase

# Create your tests here.
# def baidu_detect():
# 	detectUrl = "http://localhost:8001/postpic/"
# 	params = {"image": open("dou21.jpg", "rb")}
# 	params = urllib.urlencode(params)
# 	request = urllib2.Request(url=detectUrl, data=params)
# 	request.add_header('Content-Type', 'multipart/form-data')
# 	response = urllib2.urlopen(request)
# 	content = response.read()
# 	print content
# 	return content

# baidu_detect()

import requests
url = "http://localhost:8001/postpic/"
files = {'image': open('dou22.jpg', 'rb')}
print os.getcwd()
r= requests.post(url, files=files)
print r.content

# r = requests.post (server('new'), files={'content' : open('test.md', 'rb')})